<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>闭包内容</title>
</head>
<body>
    
</body>
</html>

<script>
    // 闭包的十种用法
    // https://blog.csdn.net/Ed7zgeE9X/article/details/133819940?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171777490016800227444714%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=171777490016800227444714&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-133819940-null-null.142^v100^pc_search_result_base8&utm_term=js%E9%97%AD%E5%8C%85%E7%9A%84%E5%AE%9E%E9%99%85%E5%BA%94%E7%94%A8%E5%9C%BA%E6%99%AF&spm=1018.2226.3001.4187
    function fun1() {
        let aNum = 1
        return function() {
            return ++aNum
        }
    }
    let counter = fun1()
    console.log('第一次调用:', counter());
    console.log('第二次调用:', counter());
</script>